﻿/****************************************************************************
 * Application   : Freekick Desktop Manager
 * Author        : sfreekick
 * Email         : sfreekick@gmail.com
 * Copyright     : (C) 2008 sfreekick
 * **************************************************************************/

/****************************************************************************
 *  This file is part of FreeKickManager.
 *
 *  FreeKickManager is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  FreeKickManager is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with FreeKickManager. If not, see <http://www.gnu.org/licenses/>.
 ****************************************************************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace FreeKickManager
{
    public class Equipo : IComparable
    {
        public int id = 0;
        public string nombre = "";

        public int ganados = 0;
        public int empatados = 0;
        public int perdidos = 0;

        public int golesFavor = 0;
        public int golesContra = 0;

        public int puntos = 0;

        public Equipo()
        {
            ;
        }

        public Equipo(int id, string nombre)
        {
            this.id = id;
            this.nombre = nombre;
        }

        public int CompareTo(object obj)
        {
            int res = 0;

            Equipo eq = (Equipo)obj;

            if (this.puntos < eq.puntos)
            {
                res = -1;
            }
            else if (this.puntos > eq.puntos)
            {
                res = 1;
            }
            else
            {
                if ((this.golesFavor - this.golesContra) < (eq.golesFavor - eq.golesContra))
                {
                    res = -1;
                }
                else if ((this.golesFavor - this.golesContra) > (eq.golesFavor - eq.golesContra))
                {
                    res = 1;
                }
                else
                {
                    if (this.ganados < eq.ganados)
                    {
                        res = -1;
                    }
                    else if (this.ganados > eq.ganados)
                    {
                        res = 1;
                    }
                }
            }

            return res;
        }
    }
}
